package core;

import world.maps.CurrentMap;
import world.objects.MyChar;

import javax.imageio.ImageTypeSpecifier;
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;

/**
 * Created by IntelliJ IDEA.
 * User: Jake
 * Date: 19/12/11
 * Time: 17:47
 * To change this template use File | Settings | File Templates.
 */
public class GameEngine {

    public static boolean leftKey = false;
    public static boolean rightKey = false;
    public static boolean upKey = false;
    public static boolean downKey = false;
    private GameDisplay g;
    private CurrentMap cm = new CurrentMap();

    public GameEngine() {

        JFrame j = new JFrame();
        g = new GameDisplay();
        j.add(g);
        j.setVisible(true);
        j.setSize(512, 512);
        j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        step();
    }

    private void step() {
        while (true) {
            Object a = new Object();
            synchronized (a) {
                try {
                    a.wait(10);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            updateGraphics();
        }
    }

    private void updateGraphics() {
  g.updateGraphics();
    }


}
